

//
//  HeaderView.m
//  UICollectionVIewDemo
//
//  Created by 曾墨 on 16/10/25.
//  Copyright © 2016年 YuanJiang. All rights reserved.
//

#import "HeaderView.h"

@implementation HeaderView

-(instancetype)initWithFrame:(CGRect)frame
{
    self= [super initWithFrame:frame];
    if (self) {
        self.headerLabel= [[UILabel alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, self.frame.size.height)];
        self.headerLabel.backgroundColor= [UIColor blueColor];
        [self.headerLabel setTextAlignment:NSTextAlignmentRight];//或者将19-21添加到懒加载里
        [self addSubview:self.headerLabel];
    }
    return self;
    
}

//视图发生变化 触发这个方法
-(void) layoutSubviews
{
    self.headerLabel.frame =CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, self.frame.size.height);
}















@end
